package com.jiyinit.web.core.business.dao;

import com.jiyinit.core.framework.base.paging.PagingResult;
import com.jiyinit.core.framework.dao.mybatis.base.MybatisDaoContext;
import com.jiyinit.core.framework.dao.mybatis.paginator.domain.PageBounds;
import com.jiyinit.web.core.business.dto.FunctionPageRequest;
import com.jiyinit.web.core.business.entity.TabCoreFunEntity;
import com.jiyinit.web.core.business.entity.TabCoreMemoireEntity;
import com.jiyinit.web.core.business.vo.FunctionVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p></p>
 * <p/>
 * <PRE>
 * <BR>	修改记录
 * <BR>-----------------------------------------------
 * <BR>	修改日期			修改人			修改内容
 * </PRE>
 *
 * @author changly
 * @version 1.0
 * @date 2017/4/11 17:51
 * @since 1.0
 */
@Repository("core.tabCoreMemoireDao")
public class TabCoreMemoireDao {

    /**
     * 日志对象
     */
    private static Logger logger = LoggerFactory.getLogger(TabCoreMemoireDao.class);

    private String SQLID = "core.tabCoreMemoire.";

    @Autowired
    @Qualifier("core.MybatisDaoContext")
    private MybatisDaoContext mybatisDaoContext;

    public int update(List<TabCoreMemoireEntity> list){
        return mybatisDaoContext.batchUpdate(SQLID+"batchUpdate",list);
    }

    public List<TabCoreMemoireEntity> findRemind(){
        return mybatisDaoContext.findAll(SQLID+"findRemind",TabCoreMemoireEntity.class,null);
    }

    public int add(TabCoreMemoireEntity entity){
        return mybatisDaoContext.save(SQLID+"insertSelective",entity);
    }

    public int delete(Integer id ,Integer userId){
        HashMap<String,Object> params = new HashMap<>();
        params.put("userId",userId);
        params.put("id",id);
        return mybatisDaoContext.update(SQLID+"delete",params);

    }
}
